var mongoose = require('mongoose');

mongoose.connect('mongodb://localhost/test');

var schema = mongoose.Schema;

var imageSchema = new schema({
    id:{
        type:String,
        required:true
    },
    title:{
        type:String,
        required:true
    },
    img_url:{
        type:String,
        required:true
    },
    zhaiyao:{
        type:String,
        required:true
    },
    cateid:{
        type:Number,
        required:true
    }
});
var image = mongoose.model('image',imageSchema);
/*var admin = new image({
    cateid:0,
    id:1,
    title:'甜美美女',
    img_url:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552979074&di=468c9fe9ba19cdf39907b983b51f9b2b&imgtype=jpg&er=1&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F2018-05-10%2F5af4336c6805c.jpg',
    zhaiyao:'甜美可爱，哈哈哈哈'
});
var admin1 = new image({
    cateid:0,
    id:2,
    title:'甜美美女',
    img_url:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552384353637&di=9c066623923015707305451fbd834b55&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fea52c1c9e5df4039ce5275095a0649921ad083244d20a-Lf82xv_fw658',
    zhaiyao:'甜美可爱，哈哈哈哈'
});
var admin2 = new image({
    cateid:0,
    id:3,
    title:'甜美美女',
    img_url:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1552384353637&di=32414b3354cfe74e115d58b85a22f943&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201607%2F08%2F20160708171619_3PVzT.jpeg',
    zhaiyao:'甜美可爱，哈哈哈哈'
});
admin.save(function (err, ret) {
    if (err) {
        console.log('保存失败')
    } else {
        console.log('保存成功')
        console.log(ret)
    }
});
admin1.save(function (err, ret) {
    if (err) {
        console.log('保存失败')
    } else {
        console.log('保存成功')
        console.log(ret)
    }
});
admin2.save(function (err, ret) {
    if (err) {
        console.log('保存失败')
    } else {
        console.log('保存成功')
        console.log(ret)
    }
});*/

module.exports = image;

